<template>
	<loading-wait v-if="loading" ></loading-wait>
	<view class="uni-global-box">
		<view class="uni-global-title">
			任务日志 / 评价列表
		</view>
		<view class="">
			<view class="class-manage-top">
				<view class=""> 
				</view>
				
			</view>
			<u-table class="u-table-senior">
				<u-tr style="margin-right:15px;" class="sticky-table-th" >
					<u-th class="u-table-th " width="150px">项目图片</u-th>
					<u-th class="u-table-th " width="150px">项目标题</u-th>
					<u-th class="u-table-th " width="150px">项目价格</u-th>
					<u-th class="u-table-th " width="150px">用户名称</u-th>
					<u-th class="u-table-th " width="150px">订单号</u-th>
					<u-th class="u-table-th " width="150px">评价内容</u-th>
					<u-th class="u-table-th " width="150px">态度评分</u-th>
					<u-th class="u-table-th " width="150px">水平评分</u-th>
					<u-th class="u-table-th " width="150px">额外收费</u-th>
					<u-th class="u-table-th " width="150px">收费金额</u-th>
					<u-th class="u-table-th " width="150px">IP地址</u-th>
					<u-th class="u-table-th sticky-right sticky-shadow" width="150px" :style="`right:${100}px`">创建时间</u-th>
					<u-th width="100px" class="sticky-right" >操作</u-th>
				</u-tr>
				<u-empty text="暂无订单" mode="order" v-if="nullData" ></u-empty>
				<loaders v-if="data==0 && !nullData"></loaders>
				<u-tr v-for="(item,index) in data" :key="index" class="u-table-tr">
					<u-td class="u-table-td" width="150px">
						<view class="flex-layout">
							<u-image width="80px" height="50px" :src="item.item.image" @click="eventImage(item.item.image)"></u-image>
						</view>
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{item.item.title}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						￥{{ (item.item.price /100).toFixed(2) }}
					</u-td>
					
					<u-td class="u-table-td" width="150px">
						{{item.userinfo.name}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{item.oder_no}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{item.content}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{(item.stance /10).toFixed(1)}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{(item.level /10).toFixed(1)}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{item.is_extra?'有额外收费':'无额外收费'}}
					</u-td>
					<u-td class="u-table-td" width="150px">
						￥{{ (item.extra_price /100).toFixed(2) }}
					</u-td>
					<u-td class="u-table-td" width="150px">
						{{item.create_ip}}
					</u-td>
					<u-td class="u-table-td sticky-right sticky-shadow " :style="`right:${100}px`" width="150px">
						<uni-dateformat :date="item.create_date" ></uni-dateformat> 
					</u-td>
					<u-td class="u-table-td sticky-right " width="100px">
						<view class="u-table-td-util">
							<u-button size="mini" @click="goUrl('./detail?uid='+item._id)" type="primary" >
								<text class="iconfont icon-chakan"></text>
								<text>详情</text>
							</u-button>
						</view>
				
					</u-td>
				</u-tr>
				
			</u-table>
			<view class="u-table-senior-pagination">
				<uni-pagination @change="enventPages" :total="count"></uni-pagination>
			</view>
		</view>


	</view>
	<u-toast ref="uToast" />
</template>

<script>
	const global = uniCloud.importObject("global",{customUI:true});
	export default {
		data() {
			return {
				loading:false,
				nullData:false,
				data: [],
				where: {},
				// 分页
				limit:10,
				skip:0,
				count:0,
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData() {
				global.getList('rate',this.where,"create_date asc","_id,userinfo,shop,technician,item,content,create_ip,create_date,extra_price,is_extra,level,stance" ,this.skip,this.limit).then(result => {
					const data = result.data ;
					this.count = result.count;
					this.data = data;
					this.loading = false ;
					if(  data.length==0 )return this.nullData = true;
				})
			},
			// 分页
			enventPages(val){
				this.loading = true
				this.skip = ( val.current-1) * 10 ;
				this.getData()
			},
			goUrl(url){
				uni.navigateTo({url})
			},
			// 图片放大
			eventImage(image) {
				if(typeof image == 'string'){
					image = [image];
				}
				uni.previewImage({
					urls: image,
				});
			},
		}
	}
</script>

<style  scoped lang="scss" >
	@import url("/common/css/ui-table.scss");
	.class-manage-top{
		display: flex;
		padding:5px 20px ;
		justify-content:flex-end;
	}
</style>